import { network } from '@/utils';
import qs from 'qs';

import { tookDeposit } from '../../../../../config/Apis';

export async function queryTookManagementList(params: any) {
  return network.get(tookDeposit.sending_list, {
    params,
  });
}

export async function queryTookManagementSendCount(params: any) {
  return network.get(tookDeposit.sending_count, { params });
}

export async function queryTookManagementSendTypes() {
  return network.get(tookDeposit.sending_sendType);
}

export async function queryCancelList() {
  return network.get(tookDeposit.sending_cancelList);
}

export async function operactionCancelOrder(params: any) {
  return network.post(tookDeposit.sending_cancelOrder, { data: params });
}

export async function queryInforExcal(params: any) {
  window.location.href = `${tookDeposit.sending_exportOrderExcel}?${qs.stringify(params)}`;
}

export async function queryCainiaoShippAddr(params: any) {
  return network.get(tookDeposit.sending_cainiaoShippAddr, { params });

  return {
    "code": 0,
    "msg": "成功",
    "body": {
      "default_info": {
        "branch_code": "100022",
        "addr_order_id": 4682632,
        "branch_name": "北京朝阳区酒仙桥公司",
        "addr_info": {
          "province": "北京",
          "city": "北京市",
          "district": "朝阳区",
          "isSelected": false,
          "detail": "酒仙桥路甲四号宏源大厦10层2"
        }
      },
      "all_list": [
        {
          "branch_code": "100022",
          "addr_order_id": 4682632,
          "branch_name": "北京朝阳区酒仙桥公司",
          "addr_info_list": [
            {
              "province": "北京",
              "city": "北京市",
              "district": "朝阳区",
              "detail": "酒仙桥路甲四号宏源大厦10层1"
            },
            {
              "province": "北京",
              "city": "北京市",
              "district": "朝阳区",
              "detail": "酒仙桥路甲四号宏源大厦10层2"
            },
          ]
        },
        {
          "branch_code": "100023",
          "addr_order_id": 4682633,
          "branch_name": "北京朝阳区酒仙桥公司3",
          "addr_info_list": [
            {
              "province": "北京",
              "city": "北京市",
              "district": "朝阳区",
              "detail": "酒仙桥路甲四号宏源大厦10层3"
            },
            {
              "province": "北京",
              "city": "北京市",
              "district": "东城区",
              "detail": "酒仙桥路甲四号宏源大厦10层4"
            },
          ]
        },
        {
          "branch_code": "100024",
          "addr_order_id": 4682634,
          "branch_name": "北京朝阳区酒仙桥公司4",
          "addr_info_list": [
            {
              "province": "北京",
              "city": "北京市",
              "district": "朝阳区",
              "detail": "酒仙桥路甲四号宏源大厦10层5"
            },
          ]
        },
      ]
    }
  }
}

export async function queryPrintConfInfo(params: any) {
  return network.get(tookDeposit.sending_printConfInfo, { params });

  return {
    "code": 0,
    "msg": "成功",
    "body": {
      "box_id": 21,
      "tpl_name": "一联单",
      "box_code": "1",
      "tpl_num": "65ffe684b47d421c8fe96d0586d044fc",
      "tpl_size": "76*130"
    }
  }
}

export async function queryTemplateList(params: any) {
  return network.get(tookDeposit.sending_printTemplate, { params });

  return {
    "code": 0,
    "msg": "成功",
    "body": [
      {
        "name": "一联单",
        "size_info": "76*130",
        "common_tpl_id": 9
      },
      {
        "name": "二联单",
        "size_info": "100*180",
        "common_tpl_id": 10
      }
    ]
  }
}

export async function setPrintTemplate(params: any) {
  return network.post(tookDeposit.sending_setPrintTemplate, { data: params });
}

export async function yunPrint(params: any) {
  return network.post(tookDeposit.sending_yunPrint, { data: params });
}
